﻿using System;
using System.Diagnostics;

namespace d3PrtDgn
{
	/// <summary>
	/// Global application class
	/// </summary>
	public class Global : System.Web.HttpApplication
	{

		protected void Application_Start(object sender, EventArgs e)
		{

		}

		protected void Session_Start(object sender, EventArgs e)
		{

		}

		protected void Application_BeginRequest(object sender, EventArgs e)
		{

		}

		protected void Application_AuthenticateRequest(object sender, EventArgs e)
		{

		}

		protected void Application_Error(object sender, EventArgs e)
		{
			//get reference to the source of the exception chain
			Exception ex = Server.GetLastError().GetBaseException();

			//log the details of the exception and page state to the
			//Windows 2000 Event Log
			EventLog.WriteEntry("Test Web",
			                    "MESSAGE: " + ex.Message +
			                    "\nSOURCE: " + ex.Source +
			                    "\nFORM: " + Request.Form.ToString() +
			                    "\nQUERYSTRING: " + Request.QueryString.ToString() +
			                    "\nTARGETSITE: " + ex.TargetSite +
			                    "\nSTACKTRACE: " + ex.StackTrace,
			                    EventLogEntryType.Error);

			Response.Redirect("/Error.aspx");
		}

		protected void Session_End(object sender, EventArgs e)
		{

		}

		protected void Application_End(object sender, EventArgs e)
		{

		}
	}
}